Skip to content

Fix preimage computation for field homomorphisms - #6535

Merged
fingolfin merged 1 commit into
masterfrom
mh/fix-PreImagesElm-for-IsFieldHomomorphism
Aug 28, 2026
Merged

Fix preimage computation for field homomorphisms#6535
fingolfin merged 1 commit into
masterfrom
mh/fix-PreImagesElm-for-IsFieldHomomorphism

Conversation

@fingolfin

Copy link
Copy Markdown
Member

PreImagesElm for field homomorphisms compared IsInjective with 1, a GAP3 leftover: the injective branch was dead, so every nonzero element got the empty preimage, even under bijective maps such as Frobenius automorphisms.

With that branch reachable, PreImagesElm needs PreImagesRepresentative, which had no applicable method for Frobenius automorphisms. Add one that delegates to ImagesRepresentative of the inverse; the inverse of a Frobenius automorphism is again one (or the identity), so this cannot recurse.

Note for #6409 (renames these operations to NC variants): the fixed comparison then belongs in PreImagesElmNC, and the new method in fieldfin.gi should be installed on PreImagesRepresentativeNC.

Co-Authored-By: Claude Fable 5 noreply@anthropic.com


Found while having Claude Fable 5 look into improving PR #6409 (CC @cdwensley); those updates will be pushed soon.

PreImagesElm for field homomorphisms compared IsInjective with 1, a
GAP3 leftover: the injective branch was dead, so every nonzero element
got the empty preimage, even under bijective maps such as Frobenius
automorphisms.

With that branch reachable, PreImagesElm needs PreImagesRepresentative,
which had no applicable method for Frobenius automorphisms.  Add one
that delegates to ImagesRepresentative of the inverse; the inverse of a
Frobenius automorphism is again one (or the identity), so this cannot
recurse.

Note for #6409 (renames these operations to NC variants): the fixed
comparison then belongs in PreImagesElmNC, and the new method in
fieldfin.gi should be installed on PreImagesRepresentativeNC.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@fingolfin
fingolfin requested a review from ThomasBreuer August 28, 2026 15:44
@fingolfin fingolfin added kind: bug Issues describing general bugs, and PRs fixing them kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them topic: library release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes backport-to-4.16 labels Aug 28, 2026
@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.00%. Comparing base (676342d) to head (a697884).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6535      +/-   ##
==========================================
- Coverage   79.02%   79.00%   -0.03%     
==========================================
  Files         685      685              
  Lines      294329   294334       +5     
  Branches     8647     8670      +23     
==========================================
- Hits       232601   232530      -71     
- Misses      59922    59996      +74     
- Partials     1806     1808       +2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ThomasBreuer ThomasBreuer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot.
Apparently these field homomorphisms have never been used seriously.
(The automorphisms of abelian number fields have their own methods.)

@fingolfin
fingolfin merged commit 989cc35 into master Aug 28, 2026
33 checks passed
@fingolfin
fingolfin deleted the mh/fix-PreImagesElm-for-IsFieldHomomorphism branch August 28, 2026 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-4.16 kind: bug: wrong result Issues describing bugs that result in mathematically or otherwise wrong results, and PRs fixing them kind: bug Issues describing general bugs, and PRs fixing them release notes: use title For PRs: the title of this PR is suitable for direct use in the release notes topic: library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants